<?
require('lang.php');

$return = getValue('return', 'str', 'GET', base64_encode('/'));

if (!is_array($_SESSION['cart']))
{
	redirect($con_root_path . 'showcart.php?return=' . $return);
}

$max = count($_SESSION['cart']);
$temp = array();
$j = 0;
for ($i=0;$i<$max;$i++)
{
	$delete = getValue('delete' . $i, 'int', 'POST', 0);
	$quantity = getValue('quantity' . $i, 'int', 'POST', 0);
	if ($quantity < 0)
	{
		$quantity = 0;
	}
	if ($delete == 0 && $quantity != 0)
	{
		$temp_2 = array();
		$temp_2['pro_id'] = $_SESSION['cart'][$i]['pro_id'];
		$temp_2['pro_quantity'] = $quantity;
		$temp[$j] = $temp_2;
		++$j;
	}
}
$_SESSION['cart'] = $temp;
//var_dump($_SESSION['cart']);die();
redirect($con_root_path . 'showcart.php?return=' . $return);
?>